package com.eqdd.yiqidian.utils;

import android.support.v4.widget.NestedScrollView;

/**
 * @author吕志豪 .
 * @date 18-1-30  下午4:13.
 * Github :https://github.com/lvzhihao100
 * E-Mail：1030753080@qq.com
 * 简书 :http://www.jianshu.com/u/6e525b929aac
 */

public class ScrollLoadMoreUtil {
    public static void loadMore(NestedScrollView scrollView, OnLoad onLoad) {
        scrollView.setOnScrollChangeListener((NestedScrollView.OnScrollChangeListener) (v, scrollX, scrollY, oldScrollX, oldScrollY) -> {
            if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
                onLoad.load();
            }
        });
    }

    public interface OnLoad {

        void load();
    }
}
